package com.tanhua.server.controller;

import com.tanhua.server.service.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author anshuai
 * @create 2021-02-28 20:10
 */
@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;

    /**
     * 桃花传音-发送语音
     * POST /peachblossom
     */
    @PostMapping
    public ResponseEntity sendVoice(MultipartFile soundFile) throws IOException {

        return peachblossomService.sendVoice(soundFile);
    }

    /**
     * 桃花传音-接收语音
     * GET /peachblossom
     */
    @GetMapping
    public ResponseEntity receivingVoice(){
        return peachblossomService.receivingVoice();
    }

}
